package com.ruoyi.web.controller.system;

import java.util.List;

import com.ruoyi.common.core.domain.entity.RvSealUpdateStateLog;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.service.IRvSealUpdateStateLogService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 状态发布日志Controller
 * 
 * @author ess
 * @date 2021-10-18
 */
@RestController
@RequestMapping("/system/rvSealStateLog")
public class RvSealUpdateStateLogController extends BaseController
{
    @Autowired
    private IRvSealUpdateStateLogService rvSealUpdateStateLogService;

    /**
     * 查询状态发布日志列表
     */
    @PreAuthorize("@ss.hasPermi('system:rvSealStateLog:list')")
    @GetMapping("/list")
    public TableDataInfo list(RvSealUpdateStateLog rvSealUpdateStateLog)
    {
        startPage();
        List<RvSealUpdateStateLog> list = rvSealUpdateStateLogService.selectRvSealUpdateStateLogList(rvSealUpdateStateLog);
        return getDataTable(list);
    }

    /**
     * 导出状态发布日志列表
     */
    @PreAuthorize("@ss.hasPermi('system:rvSealStateLog:export')")
    @Log(title = "状态发布日志", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(RvSealUpdateStateLog rvSealUpdateStateLog)
    {
        List<RvSealUpdateStateLog> list = rvSealUpdateStateLogService.selectRvSealUpdateStateLogList(rvSealUpdateStateLog);
        ExcelUtil<RvSealUpdateStateLog> util = new ExcelUtil<RvSealUpdateStateLog>(RvSealUpdateStateLog.class);
        return util.exportExcel(list, "状态发布日志数据");
    }

    /**
     * 获取状态发布日志详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:rvSealStateLog:query')")
    @GetMapping(value = "/{logId}")
    public AjaxResult getInfo(@PathVariable("logId") String logId)
    {
        return AjaxResult.success(rvSealUpdateStateLogService.selectRvSealUpdateStateLogByLogId(logId));
    }

    /**
     * 新增状态发布日志
     */
    @PreAuthorize("@ss.hasPermi('system:rvSealStateLog:add')")
    @Log(title = "状态发布日志", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody RvSealUpdateStateLog rvSealUpdateStateLog)
    {
        return toAjax(rvSealUpdateStateLogService.insertRvSealUpdateStateLog(rvSealUpdateStateLog));
    }

    /**
     * 修改状态发布日志
     */
    @PreAuthorize("@ss.hasPermi('system:rvSealStateLog:edit')")
    @Log(title = "状态发布日志", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody RvSealUpdateStateLog rvSealUpdateStateLog)
    {
        return toAjax(rvSealUpdateStateLogService.updateRvSealUpdateStateLog(rvSealUpdateStateLog));
    }

    /**
     * 删除状态发布日志
     */
    @PreAuthorize("@ss.hasPermi('system:rvSealStateLog:remove')")
    @Log(title = "状态发布日志", businessType = BusinessType.DELETE)
	@DeleteMapping("/{logIds}")
    public AjaxResult remove(@PathVariable String[] logIds)
    {
        return toAjax(rvSealUpdateStateLogService.deleteRvSealUpdateStateLogByLogIds(logIds));
    }
}
